﻿// Grade.cpp : 实现文件
//

#include "stdafx.h"
#include "学生管理系统MFC.h"
#include "Grade.h"
#include "afxdialogex.h"


// CGrade 对话框

IMPLEMENT_DYNAMIC(CGrade, CDialog)

CGrade::CGrade(CWnd* pParent /*=NULL*/)
	: CDialog(IDD_GRADE, pParent)
{

}

CGrade::~CGrade()
{
}

void CGrade::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_TAB1, m_tab);
}


BEGIN_MESSAGE_MAP(CGrade, CDialog)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, &CGrade::OnTcnSelchangeTab1)
END_MESSAGE_MAP()


// CGrade 消息处理程序


BOOL CGrade::OnInitDialog()
{
	CDialog::OnInitDialog();
	m_tab.InsertItem(0, _T("成绩查询"));
	m_tab.InsertItem(1, _T("考试安排查询"));
	m_tab.SetCurSel(0);//设置默认选项卡  
	m_querygrade.Create(IDD_QUERYGRADE, &m_tab);
	m_examarrangequery.Create(IDD_EXAMARRANGEQUERY, &m_tab);
	//设定在Tab内显示的范围
	CRect rc;
	m_tab.GetClientRect(rc);
	rc.top += 20;
	rc.bottom -= 0;
	rc.left += 0;
	rc.right -= 0;
	m_querygrade.MoveWindow(&rc);
	m_examarrangequery.MoveWindow(&rc);
	m_querygrade.ShowWindow(SW_SHOW);
	m_examarrangequery.ShowWindow(SW_HIDE);
	// TODO:  在此添加额外的初始化

	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CGrade::OnTcnSelchangeTab1(NMHDR *pNMHDR, LRESULT *pResult)
{
	// TODO: 在此添加控件通知处理程序代码
	int m_CurSelTab = m_tab.GetCurSel();

	// TODO: Add your control notification handler code here
	if (m_CurSelTab == 0)
	{
		m_querygrade.ShowWindow(SW_SHOW);
		m_examarrangequery.ShowWindow(SW_HIDE);
	}
	else if (m_CurSelTab == 1)
	{
		m_querygrade.ShowWindow(SW_HIDE);
		m_examarrangequery.ShowWindow(SW_SHOW);
	}
	m_CurSelTab = 1 - m_CurSelTab;
	*pResult = 0;
}
void CGrade::OnOK()
{

}
